package com.cg.service.impl;

import com.cg.entities.User;
import com.cg.input.UserId;
import com.cg.input.IntResult;
import com.cg.input.LoginInput;
import com.cg.input.UserInput;
import com.cg.mapper.UserMapper;
import com.cg.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * @author cheyinbo
 * @description TODO
 * @date 2021/6/24 15:38
 */
@Service
@RequiredArgsConstructor
public class UserServiceImpl implements UserService {

    private final UserMapper userMapper;

    @Override
    public User login(LoginInput loginInput) {
        return userMapper.login(loginInput);
    }

    @Override
    public User queryUser(UserId userId) {
        return userMapper.queryUser(userId);
    }

    @Override
    public User insertUser(UserInput userInput) {
        userMapper.insertUser(userInput);
        User user = new User();
        return user;
    }

    @Override
    public Boolean deleteUser(UserId userId) {
        return userMapper.deleteUser(userId) > 0;
    }

    @Override
    public Boolean updateUser(UserInput userInput) {
        return userMapper.updateUser(userInput) > 0;
    }
}
